load("//bazel:mongo_src_rules.bzl", "mongo_cc_library", "mongo_cc_unit_test")

package(default_visibility = ["//visibility:public"])

exports_files(
    glob([
        "*.h",
        "*.cpp",
    ]),
)

mongo_cc_library(
    name = "matcher_rewrites",
    srcs = [
        "expression_bitset_tree_converter.cpp",
        "expression_optimizer.cpp",
        "expression_parameterization.cpp",
        "expression_restorer.cpp",
        "expression_simplifier.cpp",
        "rewrite_expr.cpp",
    ],
    deps = [
        "//src/mongo/db:query_expressions",
        "//src/mongo/db/query/compiler/rewrites/boolean_simplification",
    ],
)

mongo_cc_unit_test(
    name = "matcher_rewrites_test",
    srcs = [
        "expression_bitset_tree_converter_test.cpp",
        "expression_optimizer_test.cpp",
        "expression_parameterization_test.cpp",
        "expression_restorer_test.cpp",
        "expression_simplifier_test.cpp",
        "rewrite_expr_test.cpp",
    ],
    tags = ["mongo_unittest_first_group"],
    deps = [
        ":matcher_rewrites",
        "//src/mongo/db/pipeline:expression_context_for_test",
        "//src/mongo/db/query:query_test_service_context",
    ],
)
